import React, { Component } from 'react'


export default class CollectionList extends Component {
    render() {
        const {collection, delItem} = this.props;
        return (
            <div>
                <h2>收藏列表</h2>
                <ul>
                    {
                        collection.map((val,index)=><li key={index} className='collection'>
                            <span>{val.name}</span>
                            <button onClick={()=>delItem(val)}>取消收藏</button>
                        </li>)
                    }
                </ul>
            </div>
        )
    }
}
